import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QDialog,
        QGroupBox, QHBoxLayout, QVBoxLayout)
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot

class App(QDialog):
    def __init__(self):
        super().__init__()
        self.setGeometry(30,50,200,100)
        self.window_layout()
        self.show()

    def window_layout(self):
        self.group_layout()

        windowLayout = QVBoxLayout()
        windowLayout.addWidget(self.group_box)
        self.setLayout(windowLayout)

    def group_layout(self):
        self.group_box = QGroupBox('What is your favor')
        layout = QHBoxLayout()

        buttonBlue = QPushButton('Blue', self)
        buttonBlue.clicked.connect(self.on_click)
        layout.addWidget(buttonBlue)

        btnRed = QPushButton('Red', self)
        btnRed.clicked.connect(self.on_click)
        layout.addWidget(btnRed)

        btnGreen = QPushButton('Green', self)
        btnGreen.clicked.connect(self.on_click)
        layout.addWidget(btnGreen)

        self.group_box.setLayout(layout)

    @pyqtSlot()
    def on_click(self):
        print('PyQt5 button clicked.')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = App()
    sys.exit(app.exec_())
    

